home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SRC\IRCII-2.6\CONFIGUR.IN < prev    next >
Text File  |  1994-12-28  |  10KB  |  516 lines

  1. dnl configure.in for ircii, 2.3.  copyright (c) matthew green, 1993,
  2. dnl except those bits attributed otherwise.
  3. dnl thanks to the screen 3.3 configure.in for giving me examples to
  4. dnl work from and steal ;)
  5. dnl
  6. dnl @(#)$Id: configure.in,v 1.40 1994/10/16 00:30:09 mrg Stab $
  7.  
  8. AC_REVISION($Revision: 1.40 $)dnl
  9. AC_INIT(source/irc.c)
  10. AC_CONFIG_HEADER(include/defs.h)
  11.  
  12. dnl
  13. dnl grok the version number - from source/irc.c
  14. dnl
  15.  
  16. VERSION=`sed -n -e 's/"$//' -e '/#define IRCII_VERSION    *"/s///p' -e '/#define IRCII_VERSION/q' < source/irc.c` 
  17. echo this is ircii version $VERSION
  18. echo
  19. AC_SUBST(VERSION)
  20.  
  21. dnl
  22. dnl initial stuff
  23. dnl
  24.  
  25. AC_PROG_CC
  26. AC_PROG_CPP
  27. AC_ISC_POSIX
  28. AC_AIX
  29. AC_PROG_LEX
  30. AC_GCC_TRADITIONAL
  31. AC_IRIX_SUN
  32.  
  33. dnl use this later for checking curses/termcap
  34. case "$DEFS" in
  35.   *-D_ALL_SOURCE*)
  36.     aix=1
  37.     ;;
  38. esac
  39.  
  40. echo checking for qnx
  41. case "$(uname -s)" in
  42.     QNX*) LDFLAGS=-N64k                  dnl 64k of stack
  43.           CFLAGS="-w4 -O -g -fi=unix.h"  dnl better compile options
  44.       ;;
  45. esac
  46.  
  47. echo checking for solaris
  48. if /bin/sun 2> /dev/null
  49. then
  50.   uname=`uname -r`
  51.   case "$uname" in
  52.     4.*)
  53.       ;;
  54.     5.*) AC_DEFINE(__solaris__)
  55.      AC_DEFINE(SVR4)
  56.       ;;
  57.   esac
  58. fi
  59.  
  60. case "$DEFS" in
  61.   *-DSVR4*)            dnl might be defined above...
  62.    ;;
  63.   *)
  64.  
  65. echo checking for SVR4
  66. AC_PROGRAM_EGREP(yes,
  67. [#if defined(SVR4) || defined(__svr4__)
  68.   yes
  69. #endif
  70. ],svr4=1)
  71.     ;;
  72. esac
  73.  
  74. if test -n "$svr4"
  75. then
  76.   LIBS="-L/usr/ccs/lib $LIBS"
  77.   AC_DEFINE(SVR4)
  78. fi
  79.  
  80. dnl
  81. dnl testing for svr3/wollengong tcp's /usr/netinclude
  82. dnl
  83.  
  84. echo checking for -I/usr/netinclude
  85. if test -d /usr/netinclude; then
  86.   CFLAGS="$CFLAGS -I/usr/netinclude"
  87. fi
  88.   
  89. AC_HAVE_HEADERS(sys/un.h sys/select.h sys/fcntl.h sys/file.h sys/time.h sys/wait.h sys/twg_config.h sys/ptem.h)dnl sys/ ones
  90. AC_HAVE_HEADERS(stdarg.h unistd.h fcntl.h string.h memory.h netdb.h limits.h)dnl non sys/ ones
  91. AC_FUNC_CHECK(setsid, AC_DEFINE(HAVE_SETSID),)
  92. AC_FUNC_CHECK(getpgid, AC_DEFINE(HAVE_GETPGID),)
  93. AC_FUNC_CHECK(getsid, AC_DEFINE(HAVE_GETSID),)
  94. AC_FUNC_CHECK(scandir, AC_DEFINE(HAVE_SCANDIR),)
  95. AC_FUNC_CHECK(memmove, AC_DEFINE(HAVE_MEMMOVE),)
  96. AC_FUNC_CHECK(uname, AC_DEFINE(HAVE_UNAME),
  97.   AC_HAVE_LIBRARY(posix,
  98.   oLIBS=$LIBS
  99.   LIBS="$LIBS -lposix"
  100.   AC_FUNC_CHECK(uname, AC_DEFINE(HAVE_UNAME), LIBS=$oLIBS)))
  101. AC_FUNC_CHECK(getcwd,, AC_DEFINE(NEED_GETCWD))
  102. AC_FUNC_CHECK(fchmod,, AC_DEFINE(NEED_FCHMOD))
  103. AC_FUNC_CHECK(strerror,, AC_DEFINE(NEED_STRERROR))
  104. AC_STDC_HEADERS
  105. AC_TIME_WITH_SYS_TIME
  106. AC_DIR_HEADER
  107. AC_RETSIGTYPE
  108. AC_MODE_T
  109. AC_PID_T
  110. AC_SIZE_T
  111. AC_UID_T
  112.  
  113. case $DEFS in
  114.   *HAVE_SYS_TWG_CONFIG*)  AC_DEFINE(WINS)
  115.     ;;
  116. esac
  117.  
  118. dnl
  119. dnl check for hpux, and hpux version
  120. dnl
  121.  
  122. echo checking for hpux version
  123. if test -f /hp-ux; then
  124.   hpux=1
  125.   uname=`uname -r` 2> /dev/null
  126.   case $uname in
  127.     A.09* | A.9* | a.9* | a.09* | 9* | 09*)
  128.         ;;
  129.     A.08* | A.8* | a.8* | a.08* | 8* | 08*)
  130.         AC_DEFINE(HPUX8)
  131.         ;;
  132.     A.07* | A.B7* | A.7* | a.7* | a.07* | 7* | 07*)
  133.         AC_DEFINE(HPUX7)
  134.         ;;
  135.     *)
  136.         AC_DEFINE(HPUXUNKNOWN)
  137.         ;;
  138.   esac
  139. fi
  140.  
  141. dnl
  142. dnl check for NeXT.. and -bsd switch
  143. dnl
  144.  
  145. echo checking for NeXT
  146. AC_PROGRAM_EGREP(yes,
  147. [#if defined(NeXT) || defined(__NeXT) || defined(__NeXT__)
  148.   yes
  149. #endif
  150. ],nextstep=1)
  151.  
  152. if test -n "$nextstep"; then
  153.   if test "$CC" != "gcc"; then
  154.     CC="cc -bsd"
  155.   fi
  156. fi
  157.  
  158. dnl
  159. dnl do ultrix/posix stuff
  160. dnl
  161.  
  162. echo checking for Ultrix
  163. AC_PROGRAM_EGREP(yes,
  164. [#if defined(ultrix) || defined(__ultrix) || defined(__ultrix)
  165.   yes
  166. #endif
  167. ], ULTRIX=1)
  168.  
  169. if test -n "$ULTRIX"; then
  170.   test -z "$GCC" && CC="$CC -YBSD"
  171. else
  172.   # POSIX termios is broken on Ultrix so don't look for it.
  173. echo checking for POSIX.1
  174. AC_PROGRAM_EGREP(yes,
  175. [#include <sys/types.h>
  176. #include <unistd.h>
  177. main () {
  178. #ifdef _POSIX_VERSION
  179.   yes
  180. #endif
  181. }
  182. ],AC_DEFINE(POSIX) posix=1)
  183. fi
  184.  
  185. dnl
  186. dnl check for ptx
  187. dnl
  188.  
  189. echo checking for sequent/ptx
  190. AC_PROGRAM_EGREP(yes,
  191. [#ifdef _SEQUENT_
  192.   yes
  193. #endif
  194. ], LIBS="$LIBS -lseq";seqptx=1)
  195.  
  196. dnl
  197. dnl check for struct linger
  198. dnl
  199.  
  200. echo checking for struct linger
  201. AC_HEADER_EGREP([struct( |    )*linger], sys/socket.h,, AC_DEFINE(NO_STRUCT_LINGER))
  202.  
  203. dnl
  204. dnl grok process groups
  205. dnl
  206.  
  207. case "$DEFS" in
  208.   *-DHAVE_GETSID* | *-DHAVE_GETPGID* )        dnl have a working way to grok process groups
  209.     ;;
  210.   *)                        dnl have to test if getpgrp() really does work as posix says so
  211.     echo checking if getpgrp\(\) takes an argument
  212.     AC_TEST_PROGRAM([
  213. main()
  214. {
  215.   int pid;
  216.   int pgid;
  217.  
  218.   pid = fork();
  219.  
  220.   if (0 == pid)
  221.   {
  222. #ifdef HAVE_SETSID
  223.     setsid();
  224. #else
  225.     setpgrp(0, getpid());
  226. #endif /* HAVE_SETSID */
  227.     sleep(10);
  228.   }
  229.   else
  230.   {
  231.     sleep(2);
  232.     pgid = getpgrp(pid);
  233.     kill(pid,9);
  234.     if (pid != pgid)
  235.       exit(1);
  236.   }
  237.   exit(0);
  238. }
  239. ],,echo your getpgrp\(\) is painful;AC_DEFINE(BROKEN_GETPGRP))
  240.     ;;
  241. esac
  242.  
  243. dnl
  244. dnl work out wait type..
  245. dnl
  246.  
  247. if test x$posix != x1
  248. then
  249. AC_COMPILE_CHECK(union wait,[#include <sys/types.h>
  250. #include <sys/wait.h>
  251. ],[
  252.   union wait x;
  253.   int y;
  254. #ifdef WEXITSTATUS
  255.   y = WEXITSTATUS(x);
  256. #endif
  257. ],AC_DEFINE(BSDWAIT), AC_FUNC_CHECK(waitpid,, AC_DEFINE(NEED_WAITPID)))
  258. fi
  259.  
  260. dnl
  261. dnl checking for select()
  262. dnl
  263.  
  264. oldlibs="$LIBS"
  265. AC_COMPILE_CHECK(select,,[select(0, 0, 0, 0, 0);],,
  266. LIBS="$oldlibs -lsocket"
  267. AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],libsocket=1,
  268. LIBS="$oldlibs -lnsl"
  269. AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],libnsl=1,
  270. LIBS="$oldlibs -linet"
  271. AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],libinet=1,
  272. LIBS="$oldlibs -lcposix"
  273. AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],libcposix=1,
  274. LIBS="$oldlibs -lnet -lnsl_s"
  275. AC_COMPILE_CHECK(select with $LIBS,,[select(0, 0, 0, 0, 0);],libnet=1;libnsl_s=1,
  276. LIBS=$oldlibs
  277. echo "I can not find select!  You might need to help me"
  278. ))))))
  279.  
  280. dnl
  281. dnl termcap or curses
  282. dnl
  283. if test x$hpux = x1 -o x$aix = x1
  284. then
  285.   LIBS="-lcurses $LIBS"
  286.   AC_DEFINE(USING_CURSES)
  287. else
  288. echo searching for tgetent
  289. olibs="$LIBS"
  290.   LIBS="-ltermcap $olibs"
  291.   AC_COMPILE_CHECK(libtermcap,,tgetent((char *)0, (char *)0);,AC_DEFINE(USING_TERMCAP),
  292.   LIBS="-ltermlib $olibs"
  293.   AC_COMPILE_CHECK(libtermlib,,tgetent((char *)0, (char *)0);,AC_DEFINE(USING_TERMLIB),
  294.   LIBS="-lcurses $olibs"
  295.   AC_COMPILE_CHECK(libcurses,,tgetent((char *)0, (char *)0);,AC_DEFINE(USING_CURSES),
  296.   LIBS="-lxtermcap $olibs"
  297.   AC_COMPILE_CHECK(libxtermcap,,tgetent((char *)0, (char *)0);,AC_DEFINE(USING_XTERMCAP),
  298.   echo "no tgetent - no ircii";exit)
  299. )))
  300. fi
  301.  
  302. dnl
  303. dnl signal handling
  304. dnl
  305.  
  306. echo checking signal implimentation
  307. AC_FUNC_CHECK(sigaction, AC_DEFINE(USE_SIGACTION),
  308.   AC_FUNC_CHECK(sigset, AC_DEFINE(USE_SIGSET),
  309.  
  310. echo checking for reliable signals
  311. AC_TEST_PROGRAM([
  312. #include <sys/types.h>
  313. #include <signal.h>
  314.  
  315. #ifndef SIGCHLD
  316. # define SIGCHLD SIGCLD
  317. #endif
  318. #ifdef USE_SIGSET
  319. # define signal sigset
  320. #endif
  321.  
  322. int got;
  323.  
  324. #ifdef SIGVOID
  325. void
  326. #endif
  327. hand()
  328. {
  329.   got++;
  330. }
  331.  
  332. main()
  333. {
  334.   (void)signal(SIGCHLD, hand);
  335.   kill(getpid(), SIGCHLD);
  336.   kill(getpid(), SIGCHLD);
  337.   if (got < 2)
  338.     exit(1);
  339.   exit(0);
  340. }
  341. ],,AC_DEFINE(SYSVSIGNALS))
  342. ))
  343.  
  344. case "$DEFS" in
  345.   *BSDWAIT*)
  346. echo checking for wait3 declaration
  347. AC_PROGRAM_EGREP([wait3( |    |\()],[#include <sys/types.h>
  348. #include <signal.h>
  349. #include <sys/wait.h>
  350. ],AC_DEFINE(WAIT3_DECLARED))
  351.   ;;
  352.   *)
  353. echo checking for waitpid declaration
  354. AC_PROGRAM_EGREP([waitpid( |    |\()],[#include <sys/types.h>
  355. #include <signal.h>
  356. #include <sys/wait.h>
  357. ],AC_DEFINE(WAITPID_DECLARED))
  358.   ;;
  359. esac
  360.  
  361. dnl
  362. dnl check for sys_errlist declaration
  363. dnl
  364.  
  365. echo checking for sys_errlist declaration
  366. AC_TEST_PROGRAM([
  367. #include <sys/types.h>
  368. #include <stdio.h>
  369. #include <errno.h>
  370. main()
  371. {
  372.   char *s = sys_errlist[0];
  373.   exit(0);
  374. }
  375. ],AC_DEFINE(SYS_ERRLIST_DECLARED),)
  376.  
  377. dnl
  378. dnl need this for dcc stuff
  379. dnl
  380.  
  381. echo checking for a 32 bit integer
  382. AC_TEST_PROGRAM([
  383. main()
  384. {
  385.   if (4 == sizeof(unsigned long))
  386.     exit(0);
  387.   exit(1);
  388. }
  389. ],AC_DEFINE(UNSIGNED_LONG32),AC_TEST_PROGRAM([
  390. main()
  391. {
  392.   if (4 == sizeof(unsigned int))
  393.     exit(0);
  394.   exit(1);
  395. }
  396. ],AC_DEFINE(UNSIGNED_INT32),AC_DEFINE(UNKNOWN_32INT)))
  397.  
  398. dnl
  399. dnl libraries
  400. dnl
  401.  
  402. AC_HAVE_LIBRARY(elf, LIBS="$LIBS -lelf",)
  403. AC_HAVE_LIBRARY(nls, libnls=1;AC_DEFINE(HAVE_LIB_NLS),)
  404. if test ! -n "$libsocket"; then
  405.     AC_HAVE_LIBRARY(socket, LIBS="$LIBS -lsocket",)
  406. fi
  407. if test ! -n "$libinet"; then
  408.     AC_HAVE_LIBRARY(inet, LIBS="$LIBS -linet",)
  409. fi
  410. if test ! -n "$libnsl"; then
  411.     AC_HAVE_LIBRARY(nsl, LIBS="$LIBS -lnsl",)
  412. fi
  413. AC_HAVE_LIBRARY(dgc, LIBS="$LIBS -ldgc",)
  414. AC_HAVE_LIBRARY(resolv,
  415. olibs=$LIBS
  416. LIBS="$LIBS -lresolv"
  417. AC_TEST_PROGRAM([
  418. #include <netdb.h>
  419. main()
  420. {
  421.   struct hostent *hp;
  422.  
  423.   hp = gethostbyname("foo");
  424.   exit(0);
  425. }
  426. ],,LIBS=$olibs),)
  427. dnl AC_HAVE_LIBRARY(PW, LIBS="$LIBS -lPW",)
  428.  
  429. dnl this is all stolen from perl-4.036's Configure.  larry is god.
  430. echo "generating a list of signal names..."
  431. set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
  432. $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
  433.   [sig[$3] = substr($2,4,20)]
  434.   if (max < $3 && $3 < 60) {
  435.     max = $3
  436.   }
  437. }
  438.  
  439. END {
  440.   for (i=1; i<=max; i++) {
  441.     [if (sig[i] == "")]
  442.       printf "%d", i
  443.     else
  444.       [printf "%s", sig[i]]
  445.     if (i < max)
  446.       printf " "
  447.   }
  448.   printf "\n"
  449. }
  450. '`
  451. shift
  452. case $# in
  453. 0)
  454.   set X `kill -l 2> /dev/null`
  455.   shift
  456.   case $# in
  457.   0) set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
  458.     ;;
  459.   esac
  460.   ;;
  461. esac
  462. sig_name="ZERO $*"
  463. if test -f source/sig.inc; then
  464.   /bin/rm -f source/sig.inc
  465. fi
  466. [echo $sig_name | sed -e 's/$/"};/' -e 's/ /", "/g' -e 's/^/char *signals[] = { "/' >> source/sig.inc]
  467.  
  468. dnl work out UNIX mail dir..
  469.  
  470. echo checking for unix mail directory
  471.  
  472. for foo in /var/spool/mail /usr/spool/mail /var/mail /usr/mail
  473. do
  474.   if test -d $foo; then
  475.     mdir=$foo
  476.     break
  477.   fi
  478. done
  479.  
  480. if test -n "$mdir"; then
  481.   UNIX_MAIL=\"$mdir\"
  482. else
  483.   UNIX_MAIL=\"unknown\"
  484. fi
  485.  
  486. AC_DEFINE_UNQUOTED(UNIX_MAIL, \"$mdir\")
  487.  
  488. if test -z "$CFLAGS"; then CFLAGS=-O ; fi
  489. if test -z "$LDFLAGS"; then LDFLAGS= ; fi
  490. RM="rm -f"
  491. LN="ln -s"
  492. if test ! -n "$bindir";
  493. then
  494.     bindir=\${exec_prefix}/bin
  495. fi
  496.  
  497. if test ! -n "$IRCLIB";
  498. then
  499.     IRCLIB=\${prefix}/lib/irc
  500. fi
  501.  
  502. AC_SUBST(CFLAGS)
  503. AC_SUBST(LDFLAGS)
  504. AC_SUBST(RM)
  505. AC_SUBST(LN)
  506. AC_SUBST(IRCLIB)
  507. AC_SUBST(bindir)
  508. AC_OUTPUT(Makefile source/Makefile)
  509.  
  510. echo
  511. echo well there we are, you now might want to look in include/config.h
  512. echo and see if there is anything you might want to tune, else you can
  513. echo just run a make here..  good luck!
  514. echo
  515.  
  516.